
package ueb13.uebOrder;

import ueb13.htw.queue.PriorityQueue;

/**
 *
 * @author adier
 * @version 0.2
 */
public class PriorityOrderManagment extends OrderManagment {
    
    
    private PriorityQueue pOrder;

    public PriorityOrderManagment() {
        pOrder = new PriorityQueue();   
    }

    public PriorityOrderManagment(PriorityQueue pOrder) {
        this.pOrder = pOrder;
    }
    
    /**
     * Adds a priorityorder to the Queue
     * 
     * @param element the priorityorder to add
     */
    public void add(PriorityOrder element) {
        pOrder.add(element);
    }
    
    public Object add(int orderPriority, int orderID, String client) throws Exception {
        PriorityOrder newOrder = new PriorityOrder(orderPriority, orderID, client);
        pOrder.add(newOrder);
        return newOrder;
    }
    
    
    /**
     * remove the first priorityorder 
     * 
     * @return the removed priorityorder
     */
    public PriorityOrder remove() {
        return (PriorityOrder)pOrder.removeFirst();
    }
    
    /**
     * returns the first priorityorder
     * 
     * @return the first priorityorder
     */
    public PriorityOrder getFirst(){
        return (PriorityOrder)pOrder.getFirst();
    }


    @Override
    public String toString() {
        return pOrder.toString();
    }
    
    
}
